package cn.sc.summer.token.enums;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 枚举类型：微服务访问方式枚举类
 *
 * @author a-xin
 * @date 11:38
 */
@Getter
@AllArgsConstructor
@SuppressWarnings("all")
public enum RequestTypeEnum {

    GATEWAY_NORMAL("gatewayNormal", "正常网关请求", "GAYTEWAY_NORMAL:"),
    OPEN_FEIGN("openFeign", "openfeign形式访问", "OPEN_FEIGN:"),
    OTHER_TYPE("otherType", "其余方式访问", "OTHER_TYPE:");

    private String type;
    private String info;
    private String keyPrefix;

    public static RequestTypeEnum getByType(String type) {
        if (StrUtil.isBlank(type)) {
            return null;
        }
        for (RequestTypeEnum enums : RequestTypeEnum.values()) {
            if (enums.type.equals(type)) {
                return enums;
            }
        }
        return null;
    }

}
